import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '../views/login.vue'
import main from '../views/main.vue'
import asideBar from '../components/asideBar'
import map from '../views/map.vue'
import mapdetails from '../views/map_details'
import weapon from '../views/weapon'
import shouye from '../views/shouye.vue'
import classweb from '../views/class'
import shopcart from '../views/shopcart'
import my from '../views/my'
import details from '../views/shopdetails'
import allitems from '../views/allitems'
import ceshi from '../views/ceshi'
Vue.use(VueRouter)

  const routes = [
    // {
    //   path:'/',
    //   redirect:'/map'
    // },
    {
      path: '/login',
      name: 'login',
      component: login
    },
    {
      path: '/map',
      name: 'map',
      component: map
    },
    {
      path: '/mapdetails/:mapname',
      name: 'mapdetails',
      component: mapdetails
    },
    {
      path: '/aside',
      name: 'asideBar',
      component: asideBar
    },
    {
      path:'/',
      name:'main',
      component:main
    },
    {
      path:'/weapon',
      name:'weapon',
      component:weapon,
      children:[
        {
          path:'shouye',
          name:'shouye',
          component:shouye
        },
        {
          path:'class',
          name:'class',
          component:classweb
        },
        {
          path:'my',
          name:'my',
          component:my
        }
      ]
    },
    {
      path:'/ceshi',
      name:'ceshi',
      component:ceshi
    },
    // name的作用  没有写在components里面的就不会显示在父组件里面的router-view 
    {
      path:'/shopcart',
      name:'shopcart',
      component:shopcart
    },
    {
      path:'/details',
      name:'details',
      component:details
    },
    {
      path:'/allitems',
      name:'allitems',
      component:allitems
    }
]

const router = new VueRouter({
  routes
})

export default router
